#ifndef PLANE_H
#define PLANE_H

#include "Math/Matrix4.h"
#include "Math/Vector3.h"

namespace tyro
{
	namespace Geometry
	{
		class Plane
		{
		public:

			Plane();
			Plane(FLOAT_32 a, FLOAT_32 b, FLOAT_32 c, FLOAT_32 d);

			inline void Normalise();
			inline void SetNormal( const Math::Vector3f& planeNormal );
			inline void SetNormal( FLOAT_32 x, FLOAT_32 y, FLOAT_32 z );
			inline const Math::Vector3f& GetNormal() const;
			inline void SetD( FLOAT_32 planeD );
			inline FLOAT_32 GetD() const;
			inline Math::Vector3f ProjectVector( const Math::Vector3f& vector ) const;
			inline FLOAT_32 Distance( const Math::Vector3f& point ) const;

			Math::Vector3f	normal;
			FLOAT_32		d;

		protected:

			

		private:
		};

		inline void Plane::Normalise()
		{
			const FLOAT_32 length = normal.Magnitude();
			normal.Normalise();
			d /= length;
		}

		inline void Plane::SetNormal( const Math::Vector3f& planeNormal )
		{
			normal = planeNormal;
		}

		inline void Plane::SetNormal( FLOAT_32 x, FLOAT_32 y, FLOAT_32 z )
		{
			normal = Math::Vector3f(x, y, z);
		}

		inline const Math::Vector3f& Plane::GetNormal() const
		{
			return normal;
		}

		inline void Plane::SetD( FLOAT_32 planeD )
		{
			d = planeD;
		}

		inline tyro::FLOAT_32 Plane::GetD() const
		{
			return d;
		}

		inline Math::Vector3f Plane::ProjectVector( const Math::Vector3f& vector ) const
		{
			//TODO
		}

	}
}

#endif